package flater.cairngormtips.model
{
import com.adobe.cairngorm.model.IModelLocator;

import flater.cairngormtips.model.vo.Item;
import flater.cairngormtips.util.out;

import mx.collections.ArrayCollection;
    
[Bindable]
/**
 *  A shared data model for the Cairngorm Tips examples
 *  <br/>                                              
 *  Author: <a href="http://www.adamflater.net" target="_blank">
 *  Adam Flater</a>
 *  <br/> 
 */
public class Model implements IModelLocator
{

    //----------------------------------------------------------------
    //
    //  Class variables
    //
    //----------------------------------------------------------------

    /**
     *  @private
     *  The var holding the singleton instance of Model.
     */
    private static var instance : Model = null;


    //----------------------------------------------------------------
    //
    //  Class methods
    //
    //----------------------------------------------------------------

    /**
     *  Returns the singleton instance of Model
     */
    public static function getInstance() : Model
    {
        if ( instance == null ) 
        {
            instance = new Model( new SingletonBlocker() );
        }
            
        return instance;
    }
    
    
    //----------------------------------------------------------------
    //
    //  Constructor
    //
    //----------------------------------------------------------------

    /**
     *  Constructor.
     */ 
    public function Model( singletonBlocker : SingletonBlocker ) : 
                                                            void 
    {
        super();
    }
    
    //----------------------------------------------------------------
    //
    //  Properties
    //
    //----------------------------------------------------------------
    
    /**
     *  The collection people objects
     */
    [ArrayElementType("flater.cairngormtips.model.vo.Item")] 
    public function get items() : ArrayCollection { return __items; }
    public function set items( items : ArrayCollection ) : void
    {
    	out( "Model.items set" );
    	
    	__items = items;
    }
    
    private var __items : ArrayCollection = null;
    

} //  end class
} //  end package


internal class SingletonBlocker {}